package com.niit.mall.api.client;


import com.niit.mall.api.domain.dto.ProductDTO;
import com.niit.mall.api.domain.vo.ProductVO;
import com.niit.mall.api.fallback.ProductClientFallbackFactory;
import com.niit.mall.common.api.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @BelongsProject: pardo_mall_backend
 * @BelongsPackage: com.niit.mall.api.client
 * @Author: ChuXuan
 * @CreateTime: 2025-06-08  03:11
 * @Description: 商品模块的FeignClient
 * @Version: 1.0
 */
@FeignClient(value = "product-service", fallbackFactory = ProductClientFallbackFactory.class)
public interface ProductClient {

    /**
     * 获取指定用户优惠券数量的接口方法
     *
     * @param userId 用户ID
     * @return 用户的优惠券数量
     */
    @GetMapping("product/coupon/count/{userId}")
    Long getCouponNum(@PathVariable("userId") Long userId);

    @GetMapping("product/vo")
    List<ProductVO> queryItemByIdsVO(@RequestParam("ids") List<Long> ids);

    @PutMapping("product/stock/reduce")
    CommonResult<Void> reduceStock(@RequestBody  Map<Long, Integer> productIdToQuantityMap);
}
